package com.miyake.dsp.generator.ui;

import com.miyake.dsp.generator.NoiseSetting;
import com.miyake.dsp.ui.DspTextField;
import com.miyake.dsp.ui.DspWidget;

public class NoiseSettingPanel extends DspWidget {
	/**
	 * 
	 */
	private static final long serialVersionUID = 6069418650628707099L;
	private NoiseSetting setting;

	public NoiseSettingPanel(NoiseSetting setting) {
		super();
		this.setting = setting;
		createMagnitude(setting.getMagnitude());
	}
	
	private void createMagnitude(double mag) {
		DspTextField text = new DspTextField("Magnitude");
		text.setValue(String.valueOf(mag));
		this.add(text);
		
		text.addHandler(new DspWidgetHandler() {
			@Override
			public void onChange(String value) {
				setting.setMagnitude(Double.valueOf(value));
				fireChange(value);
			}
		});	
	}
}
